package com.onetwork.core.ui.components.grid.actions;

import com.onetwork.core.ui.components.grid.listeners.GridListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;

public class AdicionarAction extends AbstractAction {
    private static final long serialVersionUID = 1L;

    private GridListener gridListener;
    public AdicionarAction(GridListener gridListener) {
        super("Adicionar",new ImageIcon(AdicionarAction.class.getResource("/imagens/add.png")));
        this.putValue(SHORT_DESCRIPTION, "Adiciona novo elemento ao grid.");
        this.putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK));
        this.putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_A));
        this.gridListener = gridListener;
   }

    public void actionPerformed(ActionEvent event) {
        this.gridListener.gridListenerAdicionar();
    }    
}
